package com.wu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wu.pojo.ArticleDraft;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 吴磊
 * @program: blog
 * @create: 2021-05-09 08:52
 */
@Mapper
public interface ArticleDraftMapper extends BaseMapper<ArticleDraft> {

    /**
     * 插入文章草稿箱
     *
     * @param articleDraft
     * @return
     */
    Integer insertArticleDraft(ArticleDraft articleDraft);

    /**
     * 根据用户Id获取草稿
     *
     * @param userId
     * @return
     */
    List<ArticleDraft> getArticleDraftListByUserId(@Param("userId") String userId);

    /**
     * 通过草稿Id删除草稿
     *
     * @param articleId
     * @return
     */
    Integer deleteArticleDraftByArticleId(@Param("articleId") String articleId);


    /**
     * 更新
     *
     * @param articleId
     * @param articleTitle
     * @param articleContent
     * @param articleDate
     * @return
     */
    Integer updateArticleDraft(@Param("articleId") String articleId,
                               @Param("articleTitle") String articleTitle,
                               @Param("articleContent") String articleContent,
                               @Param("articleDate") String articleDate);


    /**
     * 根据草稿Id获取草稿
     *
     * @param articleId
     * @return
     */
    ArticleDraft getArticleDraftByArticleId(@Param("articleId") String articleId);
}
